Move exception handler for sxp.ParseError above that for Exception, as the
authoremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 26 Oct 2005 13:59:29 +0000 (14:59 +0100)
committeremellor@leeni.uk.xensource.com <emellor@leeni.uk.xensource.com>
Wed, 26 Oct 2005 13:59:29 +0000 (14:59 +0100)
latter subsumes the former.  Minor tidy-ups.

Signed-off-by: Ewan Mellor <ewan@xensource.com>
tools/python/xen/xend/server/SrvDomainDir.py

index b410174facbed4eae31c179ff4026a8634da466c..d0bf99926183b5593ba89b269f5e8ea92142846d 100644 (file)
@@ -25,7 +25,6 @@ from xen.xend import XendDomain
 from xen.xend.XendDomainInfo import XendDomainInfo
 from xen.xend.Args import FormFn
 from xen.xend.XendError import XendError
-from xen.xend.XendLogging import log
 
 from xen.web.SrvDir import SrvDir
 from SrvDomain import SrvDomain
@@ -52,7 +51,7 @@ class SrvDomainDir(SrvDir):
         else:
             return self.domain(x)
 
-    def op_create(self, op, req):
+    def op_create(self, _, req):
         """Create a domain.
         Expects the domain config in request parameter 'config' in SXP format.
         """
@@ -66,12 +65,12 @@ class SrvDomainDir(SrvDir):
             pin.input_eof()
             config = pin.get_val()
             ok = 1
+        except sxp.ParseError, ex:
+            errmsg = 'Invalid configuration ' + str(ex)
         except Exception, ex:
             print 'op_create> Exception in config', ex
             traceback.print_exc()
             errmsg = 'Configuration error ' + str(ex)
-        except sxp.ParseError, ex:
-            errmsg = 'Invalid configuration ' + str(ex)
         if not ok:
             raise XendError(errmsg)
         try:
@@ -108,7 +107,7 @@ class SrvDomainDir(SrvDir):
         """
         return req.threadRequest(self.do_restore, op, req)
 
-    def do_restore(self, op, req):
+    def do_restore(self, _, req):
         fn = FormFn(self.xd.domain_restore,
                     [['file', 'str']])
         dominfo = fn(req.args)